﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="FormEditor.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>page47</title>
    <script type="text/javascript">



        function showCount() {
            var result;
            var num01 = prompt("请输入第一个数字：", "");
            var operator = prompt("请输入运算符：", "");

            var num02 = prompt("请输入第二个数字：", "");
            var p1 = parseInt(num01);
            var p2 = parseInt(num02);
            switch (operator) {
                case "+":
                    result = p1 + p2;
                    break;
                case "-":
                    result = p1 - p2;
                    break;
                case "*":
                    result = p1 * p2;
                    break;
                case "%":
                    result = p1 % p2;
                    break;
            }
            document.write('两数运算的结果为：' + result);
        }
    </script>
</head>

<body>
    <input name="btn" type="button" value="计算两数运算的结果" onclick="showCount()" />
</body>
</html>
